package com.yanggeng.demo.beginnerguidedemo.bean;

import java.io.Serializable;
import java.util.List;

/**
 * 拓扑模型
 * @author aiden@tronsis.com
 * @date 2018/8/2 11:29
 */
public class Topology implements Serializable {


    /**
     * address : 0
     * no : 0
     * ports : [{"address":0,"device":{},"state":"UNUSED(未使用)"}]
     * size : 0
     * state : UNUSED(未使用)
     * tier : 0
     * type : DMU(数字主单元)
     */

    private int address; // 设备拓扑接收端地址
    private int no; // 设备编号
    private int size; // 最大设备支持
    private String state; // 当前设备状态 UNUSED(未使用), NORMAL(正常), ABNORMAL(在位异常), EMPTY(不在位)
    private int tier; // 设备层级,0基
    private String type; // 设备类型 DMU(数字主单元), DEU(数字扩展单元), SEU(超级扩展单元), AMU(模拟主单元), DRU(数字远端), ARU(模拟远端)
    private List<PortBean> ports;

    public int getAddress() {
        return address;
    }

    public void setAddress(int address) {
        this.address = address;
    }

    public int getNo() {
        return no;
    }

    public void setNo(int no) {
        this.no = no;
    }

    public int getSize() {
        return size;
    }

    public void setSize(int size) {
        this.size = size;
    }

    public String getState() {
        return state;
    }

    public void setState(String state) {
        this.state = state;
    }

    public int getTier() {
        return tier;
    }

    public void setTier(int tier) {
        this.tier = tier;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public List<PortBean> getPorts() {
        return ports;
    }

    public void setPorts(List<PortBean> ports) {
        this.ports = ports;
    }

    @Override
    public String toString() {
        return "Topology{" +
                "address=" + address +
                ", no=" + no +
                ", size=" + size +
                ", state='" + state + '\'' +
                ", tier=" + tier +
                ", type='" + type + '\'' +
                ", ports=" + ports +
                '}';
    }

    public static class PortBean implements Serializable {
        private int address; // 端口地址
        private String state; // 端口状态 UNUSED(未使用), NORMAL(正常), ABNORMAL(在位异常), EMPTY(不在位)
        private Topology device;

        public int getAddress() {
            return address;
        }

        public void setAddress(int address) {
            this.address = address;
        }

        public String getState() {
            return state;
        }

        public void setState(String state) {
            this.state = state;
        }

        public Topology getDevice() {
            return device;
        }

        public void setDevice(Topology device) {
            this.device = device;
        }

        @Override
        public String toString() {
            return "PortBean{" +
                    "address=" + address +
                    ", state='" + state + '\'' +
                    ", device=" + device +
                    '}';
        }
    }
}
